package com.wc.算法基础课.A第一讲基础算法.日期问题.日期差值;

import java.util.Scanner;

/**
 * @Author congge
 * @Date 2024/3/9 13:51
 * @description 日期差值
 * https://www.acwing.com/problem/content/3501/
 */

public class Main {
    static int[] ms = new int[]{0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNextInt()) {
            int st = sc.nextInt();
            int ed = sc.nextInt();
            if (st > ed) {
                int tmp = st;
                st = ed;
                ed = tmp;
            }
            int sY = st / 10000;
            int sM = st / 100 % 100;
            int sD = st % 100;
            int eY = ed / 10000;
            int eM = ed / 100 % 100;
            int eD = ed % 100;
            System.out.println(work(eY, eM, eD) - work(sY, sM, sD) + 1);
        }
    }

    static int work(int y, int m, int d) {
        int res = 0;

        for (int i = 1; i < y; i++) {
            if (isRun(i)) ms[2] = 29;
            else ms[2] = 28;
            for (int j = 1; j <= 12; j++) {
                res += ms[j];
            }
        }
        if (isRun(y)) ms[2] = 29;
        else ms[2] = 28;
        for (int i = 1; i < m; i++) {
            res += ms[i];
        }
        res += d;
        return res;
    }

    static boolean isRun(int y) {
        return y % 4 == 0 && y % 100 != 0 || y % 400 == 0;
    }
}